using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace Elementum
{
   public class DefauldTransition : Transition
    {
        protected Animation _back;
       protected  float _alpha;

        public DefauldTransition(float startAlpha,float endAlpha,int start, int end):base(start,end) {
            _back = new Animation("images/system/black",new Point(800,480));
            _back.Alpha = startAlpha;
            _alpha = (endAlpha - startAlpha) / (end - start);
        }

        protected override void OnTransition()
        {
            if (_counter == _start)
                _stage.LockTouch = true;
            _back.Alpha += _alpha;
        }

        protected override void TransitionDone()
        {
            base.TransitionDone();
            _stage.TransitionList.Remove(this);
            _stage.LockTouch = false;
        }

        public override void OnDraw(SpriteBatch spriteBatch)
        {
            base.OnDraw(spriteBatch);
            spriteBatch.Begin();
           if (_counter >= _start && _counter <= _end)
            _back.OnDraw(spriteBatch, new Vector2(400,240));
            spriteBatch.End();
        }

    }
}
